
/**
 * @description 新闻列表页面"浏览更多"按钮对应方法
 * @author Huang Yuehong
 * @since 2018-06-27 02:08:45
 */
function loadMoreLaws(category){

    var lastlawId = $('#lawul').children("li:last-child").attr('id').replace("li","");//最后一条新闻的id
    var loadmorediv = $('#loadmore');// “浏览更多”按钮对象

    // 获取更多新闻的请求地址(每次多加载10条)
    var loadMoreUrl = "/webnews/loadMoreNews/" +category+"/"+lastlawId;

    // ajax获取新的新闻数据到前台页面
    $.ajax({
        url:loadMoreUrl,
        type:"get",
        dataType:"json",
        success:function(data){
            var map = eval("("+data+")");
            var newsMapList = map['newsMapList'];
            var isShowLoadMore = map['isShowLoadMore'];

            var length = newsMapList.length;
            var dlContent = '';

            // 加载新的新闻数据到div中
            for(var i=0;i< length;i++){
                var content = "<li id=\""+newsMapList[i]['id']+"\"><a href=\"/webnews/detail/"+ newsMapList[i]['id'] +"/"+ newsMapList[i]['category']+ "\" target=\"_blank\" ><span>"+newsMapList[i]['dateTime']+"</span>"+newsMapList[i]['title']+"</a></li>";
                dlContent = dlContent + content;
            }
            $('#lawul').append(dlContent);

            if (isShowLoadMore == 0){
                loadmorediv.hide();//隐藏“浏览更多”按钮
            }

        },
        error:function(XMLHttpRequest,textStatus, errorThrown) {
            // alert(errorThrown);
        }
    });
}